package intis

import (
	"context"
	"fmt"
	"github.com/go-redis/redis/v8"
)

var (
	Ctx = context.Background()
	Rdb *redis.Client
)

func Redis() {
	Rdb = redis.NewClient(&redis.Options{
		Addr:     "14.103.202.69:6379",
		Password: "4ay1nkal3u8ed77y", // no password set
		DB:       0,                  // use default DB
	})

	err = Rdb.Set(Ctx, "key", "value", 0).Err()
	if err != nil {
		panic("redis连接失败")
	} else {
		fmt.Println("redis连接成功")
	}
}
